<!Doctype html>
<html>
<head>
    <meta charset='UTF-8'>
    <title>Document</title>
</head>
<body>

</body>
<script>
// 递归求阶乘
function fn(a){
    if(a==1){
        return 1
    }
    return a * fn(a-1)
    /*
    fn(5)
    return 5 * 4 * 3 * 2 * 1
                return 4 * 3 * 2 * 1
                            return 3 * 2 * 1
                                        return 2 * 1
    */
}

var res = fn(5)
console.log(res);


</script>
</html>